#!/usr/bin/python
import os,sys
if len(sys.argv) <> 2:
	print 'cat_results.py <result folder prefix (end with "_")>'
	sys.exit()

s_folder_prefix = sys.argv[1]
i_len = len(s_folder_prefix)

os.system('ls > files.txt')
file = open('files.txt', 'r')
for s_line in file.readlines():
	if s_line[:i_len] == s_folder_prefix:
		s_folder = s_line.strip() + '/'
		s_befehl = 'cat ' + s_folder + '*.eel1 >> ./%s.eel1' %(s_folder_prefix[:-1])
		print s_befehl
		os.system(s_befehl)
		s_befehl = 'cat ' + s_folder + 'OUTDOCK >> ./OUTDOCK_%s' %(s_folder_prefix[:-1])
		print s_befehl
		os.system(s_befehl)
os.system('rm -rf files.txt')
